import { getList, getCheckList } from '@/api/costManagement/assignment_calculate/index';
export const getListEvent = async () => {
  const res = await getList();
  const resData = res.data.map((item: any) => {
    return {
      title: item.name,
      key: item.id,
      disabled: true,
      children: item.sub.map((subItem: any) => {
        return {
          title: subItem.name,
          key: subItem.id,
          disabled: true
        };
      })
    };
  });
  return resData;
};

export const getCheckListEvent = async () => {
  const Page = {
    page: 1,
    page_size: 100
  };
  return (await getCheckList(Page)) || [];
};

export const columns = [
  {
    title: '科目名称',
    dataIndex: 'title',
    slotName: 'title',
    ellipsis: true
  },
  {
    title: '科目级别',
    dataIndex: 'lv',
    slotName: 'lv',
    ellipsis: true
  },
  {
    title: '操作',
    slotName: 'operator',
    width: 100,
    align: 'right',
    fixed: 'right',
    bodyCellClass: 'flex-right'
  }
];

export const operatorData = [{ label: '删除', code: 'delete' }];
